﻿using System;
using System.Collections.Generic;
using System.Web;
using Hxj.Web;
using Hxj.Common;
using RicciWebsite.Model;

namespace RicciWebsite.Pages
{
    public class AdminPage : System.Web.UI.Page
    {

        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserID
        {
            get
            {
                return UserInfo.userid;
            }
        }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName
        {
            get
            {
                return UserInfo.username;
            }
        }


        /// <summary>
        /// 用户信息
        /// </summary>
        public base_user UserInfo;


        public AdminPage()
        {
            UserInfo = RicciWebsite.RicciDatabase.Default.From<base_user>().Where(base_user._.userid == RicciWebsite.Common.GetUserIDCookie()).ToFirst();

            if (null == UserInfo)
            {
                HttpContext.Current.Response.Redirect("~/admin/login.aspx");
            }

        }

        /// <summary>
        /// 设置主题
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreInit(EventArgs e)
        {
            this.Theme = "admin";

            base.OnPreInit(e);

            //设置标题
            this.Title = Hxj.Common.Utils.GetAppSettingString("websitename");
        }
        

    }
}
